-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【LocalNouns】都道府県ランダムミント時の割合設定 #158
Conversation
* duplicate from sushi-Nouns * correct Contract name * correct Contrant name * deploy NotoSans font * add font view * add font components * fix type and required * update font address * format * update @openzeppelin/contracts * update package * update package * update packages * LocalNouns initial working version --------- Co-authored-by: isamu arimoto <[email protected]> Co-authored-by: Takuya Mizutani <[email protected]> Co-authored-by: Satoshi Nakajima <[email protected]>
uint256 totalPrefectureRatio; | ||
|
||
uint256[5] ratioRank = [5, 4, 3, 3, 2]; | ||
uint256[5] acumurationRatioRank; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
acumuration -> accumulation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました
4b6a322
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cも2つ必要です。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accumulation
です。
prefectureRatio[3] = [29, 38, 42, 2, 3, 17, 44, 45, 6, 16]; | ||
prefectureRatio[4] = [37, 5, 30, 19, 41, 18, 36, 39, 32, 31]; | ||
|
||
for (uint256 i = 0; i < ratioRank.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コストラクタで計算するより値を与えておいたほうが良い気がしますが、こっちのほうがガス代が安い?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ご指摘通りです、、、
25178fd
@@ -184,4 +232,41 @@ contract LocalNounsProvider is IAssetProviderExMint, IERC165, Ownable { | |||
function getPrefectureId(uint256 _tokenId) external override returns (uint256) { | |||
return tokenIdToPrefectureId[_tokenId]; | |||
} | |||
======= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここはコンフリクトの残り?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コンフリクトのマージ失敗していたので全て修正しました。
3ccd9a1
function mint(uint256 prefectureId, uint256 _assetId) external returns (uint256) { | ||
bool randomValueForTest = false; | ||
|
||
function setRandomValueForTest(bool _test) public onlyOwner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここの変更はオーナーしかできないですが、オーナーが変更してtrueのときには、誰でもdeterminePrefectureIdでassetIdを指定できます。
デプロイ後はtrueにしないほうがよいですね。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hardhatテストでだけ使用するようにします
prefectureRatio[4] = [37, 5, 30, 19, 41, 18, 36, 39, 32, 31]; | ||
|
||
for (uint256 i = 0; i < ratioRank.length; i++) { | ||
acumurationRatioRankTotal += ratioRank[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memo
acumurationRatioRankTotal = sum ([5, 4, 3, 3, 2])
acumurationRatioRank = [5, 9, 12, 15, 17]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コードで定義するようにしました。
sumが使えるのですね。覚えておきます。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint256[5] acumulationRatioRank = [5, 9, 12, 15, 17];
uint256 acumulationRatioRankTotal = 17;
ですね(追加されたコードから)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sumは使えません。擬似コードです(メモ用)
人口比率に応じて、都道府県を5段階(A~E)にランク分けし、その割合に応じて都道府県を決定する
最初にランダム値でA~Eのどのランクの都道府県にするか決定(表中の割当数で重み付け)
uint256[5] ratioRank = [5, 4, 3, 3, 2];
ランク決定後、そのランク内の都道府県のどれにするか、ランダム値で決定