BSC链智能合约搭建
#include "vntlib.h"
KEY address owner;
KEY uint32 last_completed_migration;
constructor Migrations()
{
owner = GetSender();
}
void onlyOwner()
{
Require(Equal(owner, GetSender()), "is not owner");
}
MUTABLE
void setCompleted(uint32 completed)
{
onlyOwner();
last_completed_migration = completed;
}
UNMUTABLE
uint32 get_last_completed_migration()
{
return last_completed_migration;
}
bottle
需要有一个migrate
智能合约才能使用bottle migrate
功能,该智能合约包含特定的接口,会在第一次执行botlte migrate
时部署,此后将不会更新。在使用bottle init
创建新项目时,会默认创建该智能合约。
// Deploy a single contract without constructor arguments
deployer.deploy(A);
// Deploy a single contract with constructor arguments
deployer.deploy(A, arg1, arg2, ...);
// Don't deploy this contract if it has already been deployed
deployer.deploy(A, {overwrite: false});
// Set a maximum amount of gas and `from` address for the deployment
deployer.deploy(A, {gas: 4612388, from: "0x...."});
// External dependency example:
//
// For this example, our dependency provides an address when we're deploying to the
// live network, but not for any other networks like testing and development.
// When we're deploying to the live network we want it to use that address, but in
// testing and development we need to deploy a version of our own. Instead of writing
// a bunch of conditionals, we can simply use the `overwrite` key.
deployer.deploy(SomeDependency, {overwrite: false});
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。